<template>
    <Button type="error" size="small" @click="handleCmdDelete(data)">删除</Button>
</template>

<script>
export default {
    name: "CmdDeleteButton",
    props: {
        data: Object,
    },
    methods: {
        handleCmdDelete(row) {
            this.$Modal.confirm({
                title: '删除',
                content: '确定删除吗？',
                onOk: () => {
                    this.$http.post('/delete_cmd', { cmd_id: row.cmd_id }).then(() => {
                        this.$Message.success('删除成功');
                        this.$emit('success');
                    });
                },
                onCancel: () => {
                    this.$Message.info('取消删除');
                }
            });
        },
    }
}
</script>